/*
 * Copyright (c) 2022  by Junzhao
 * THIS FILE IS PART OF JAVASE Song Huongkang PROJECT
 * All Rights Reserved.
 */

package 练习.银行账户管理;

import org.junit.Test;

class Bank {
    private Customer[] customers;// 储存顾客的对象数组
    private int numberOfCustomer;// 客户序列号

    public Bank() {
        customers = new Customer[10];
    }

    //    public Bank(Customer[] customers, int numberOfCustomer) {
//        this.customers = customers;
//        this.numberOfCustomer = numberOfCustomer;
//    }
    /**
     * @description 
     * @param [firstName, lastName]
     * @return [java.lang.String, java.lang.String] 
     * @author 俊昭        
     * @date 2022/3/26         
    */
    public void addCustomer(String firstName, String lastName) {
        Customer customer = new Customer(firstName, lastName);
        customers[numberOfCustomer] = customer;
/*
        customers[getNumberOfCustomer].setFirstName(firstName);
        customers[getNumberOfCustomer].setFirstName(lastName);
*/
        numberOfCustomer++;
    }
    /**
     * @description 
     * @param [index]
     * @return [int] 
     * @author 俊昭        
     * @date 2022/3/26         
    */

    public Customer getCustomer(int index) {
//        return customers[index];//可能会异常
        if (index >= 0 && index < numberOfCustomer) {
            return customers[index];
        }
        return null;

    }

    public Customer[] getCustomers() {
        return customers;
    }

    public void setCustomers(Customer[] customers) {
        this.customers = customers;
    }

    public int getNumberOfCustomer() {
        return numberOfCustomer;
    }

    public void setGetNumberOfCustomer(int numberOfCustomer) {
        this.numberOfCustomer = numberOfCustomer;
    }
}
